import prompt from '@system.prompt';
import http from '@ohos.net.http';
export default {
    data: {
        title: "111",
        data_list:[0,1,2]
    },
    action_function(){
        let jsondata;
        let url = "http://123.60.188.216:8000/Person/AppRep1/";
        let httpRequest = http.createHttp();
        httpRequest.request(
            url,
            {
                method: http.POST, // 可选，默认为http.RequestMethod.GET，实际是http.POST这一点与官网不同
            }, (err, data) => {
            if (!err) {
                jsondata = JSON.parse(data.result)
                prompt.showToast({
                    message:"获取成功",
                    duration: 3000,
                })
                this.data_list = jsondata;
                console.info("成功-----------"+"data:"+data.result)
            } else {
                prompt.showToast({
                    message:"获取失败"
                })
                console.info("失败")
            }
        }
        );
    }
}
